const mongoose = require("mongoose");
const Schema = mongoose.Schema;

// creat Schema
const student = new Schema({
    // 名字
    name: {
        type: String,
        required: true
    },
    // 密码
    password: {
        type: String,
        required: true,
    },
    // 学院
    college: {
        type: String,
        required: true
    },
    // 班级
    className: {
        type: String,
        // required: true
    },
    // 任课老师
    teacherList: {
        type: String,
        // required: true
    },
    // 学号
    student_number: {
        type: String,
        required: true
    },
    // 头像
    avatar: {
        type: String,
    },
    createdDate: {
        type: Date,
        default: Date.now
    }
});

const teacher = new Schema({
    name: {
        type: String,
        require: true
    },
    password: {
        type: String,
        required: true
    },
    curriculum: {
        type: Array,
    },
    avatar: {
        type: String,
    },
    createdDate: {
        type: Date,
        default: Date.now
    }
})

module.exports = {
    student: mongoose.model("student", student),
    teacher: mongoose.model("teacher", teacher)
}

// module.exports = User = mongoose.model("student", student);